﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufInputControl.h"

namespace gnuf {
    class Color;
    
    class GNUF_BASE_EXPORT IColorControlHandler
        : public IInputControlHandler
    {
    public:
        virtual void onColorChanged(std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a) = 0;
        virtual void onSmartColorEnabled(bool) = 0;
    };
    
    class GNUF_BASE_EXPORT ColorControlAdpatation
        : public InputControlAdaptation
    {
    protected:
        ColorControlAdpatation();
        virtual ~ColorControlAdpatation();

        //
        // Inherits from InputControlAdaptation...
        virtual void onSelectionChanged(bool) override {}
        
    public:
        virtual void onColorChanged(const Color&) = 0;
        virtual void onSmartColorEnabled(bool) = 0;
    };

    class GNUF_BASE_EXPORT ColorInputControl
        : public InputControl
    {
        CANNOT_COPY_OR_ASSIGN(ColorInputControl)
    public:
        static const EItemType Type;
        ColorInputControl(IColorControlHandler *);
        virtual ~ColorInputControl() {}
        
        void setColor(const Color&, const ColorControlAdpatation * trigger = nullptr);
        void setSmartColorEnabled(bool, const ColorControlAdpatation * trigger = nullptr);
    };
}
